#include <REGX52.H>
#include "type.h"
#include "method.h"

extern time clock;
extern time alarm;


unsigned char stop_alarming = 0;
unsigned int alarm_reset_time = 0;

// 闹钟按键1实现功能
void alarm_Key1(){
	time* t = &alarm;
	t->min++;
	NCF(&alarm);
	LCD_ShowTime();
}

// 闹钟按键2实现功能
void alarm_Key2(){
	time* t = &alarm;
	t->h++;
	NCF(&alarm);
	LCD_ShowTime();
}


void stop_alarm(){
	unsigned int *p = &alarm_reset_time;
	time* t = &clock;
	stop_alarming = 1;
	*p = (60 - (t->s));
}

void alarming_judge(){
	alarm_reset_time = alarm_reset_time ? alarm_reset_time - 1 : alarm_reset_time;
	stop_alarming = alarm_reset_time ? stop_alarming : 0;
}